﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace WindowsForms
{
    public partial class RegionProcess : DevExpress.XtraEditors.XtraForm
    {
        public RegionProcess(bool? isModifyer = null)
        {
            InitializeComponent();
            if (isModifyer.HasValue)
            {
                GenerateModifyerControl(isModifyer.Value);
            }
        }

        private void GenerateModifyerControl(bool isModifyer)
        {
            if (isModifyer)
            {
                this.layoutControlGroupRegion.Text = "Chỉnh sửa thông tin khu vực";
                this.layoutControlGroupRegion.CustomizationFormText = "Chỉnh sửa thông tin khu vực";
                this.layoutControlGroupRegion.CaptionImage = global::WindowsForms.Properties.Resources.Edit;
            }
        }

        #region get, set
        public string Region_Name 
        {
            get
            {
                return txtRegionName.Text;
            }
            set
            {
                txtRegionName.Text = value;
            }
        }
        public string Region_Des
        {
            get
            {
                return txtRegionDes.Text;
            }
            set
            {
                txtRegionDes.Text = value;
            }
        }
        #endregion

        private void RegionProcess_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = !dxValidationProviderRegion.Validate() && DialogResult == DialogResult.OK;
        }
    }
}